package com.joshondesign.sdljava.demo;

import com.joshondesign.sdljava.SDLUtil;
import com.joshondesign.sdljava.SDL_Surface;
import com.joshondesign.sdljava.gfx.*;

/**
 * Created by IntelliJ IDEA.
 * User: josh
 * Date: 9/13/11
 * Time: 9:11 AM
 * To change this template use File | Settings | File Templates.
 */
public class WuPixelTest implements SDLUtil.InitCallback {

    public static void main(String ... args) {
        SDLUtil.init(new WuPixelTest());
    }

    public void callback() throws Exception {
        Util.standard_init();
        SDL_Surface surface = Util.createResizableWindow(1024,768);
        final Scene scene = new Scene(surface);
        scene.setBackgroundFill(SColor.BLACK);
        Layer layer = new Layer(surface.getFormat());
        layer.add(new WuPixelNode());
        scene.add(layer);
        scene.start();
    }

    private static class WuPixelNode extends Node {
        private double counter;

        @Override
        public void draw(GFX gfx) {
            counter += 0.3;
            for(double i=0; i<600; i+= 10.3) {
                gfx.setPaint(SColor.WHITE);
                gfx.drawWuPixel(i+counter,i+counter);
            }
        }
    }
}
